import java.util.Map;
import java.util.HashMap;

public class MarsCar{

	private String name;
	private String color;
	private int weigth;

	private Points point = new Points(0, 0);
	private ReplayCarDao carDao = new ReplayCarDao();

	public MarsCar() {

	}

	public MarsCar(Points point) {
		this.point = point;
	}

	public void move(String exe) {
		move(new String[]{exe});
	}

	public void move(String exes[]) {
		
		Points start = new Points(point.getXpoint(), point.getYpoint());

		for (String exe : exes) {
			if ("w".equals(exe)) {
				point.forward();
			}
			if ("s".equals(exe)) {
				point.back();
			}
			if ("a".equals(exe)) {
				point.left();
			}
			if ("d".equals(exe)) {
				point.right();
			}

			System.out.println(this);
		}

		Points end = new Points(point.getXpoint(), point.getYpoint());

		BlackBox bb = new BlackBox(exes, start, end);

		//ReplayCar.addReplay(bb);
		carDao.add(bb);

	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setColor(String color) {
		this.color = color;
	}

	public String getColor() {
		return color;
	}

	public void setWeigth(int weigth) {
		this.weigth = weigth;
	}

	public int getWeigth() {
		return weigth;
	}

	public Points getPoint() {
		return point;
	}

	public String toString() {
		return "(" + point.getXpoint() + ", " + point.getYpoint() + ")";
	}
}